
<!DOCTYPE html>
<html lang="zh-cmn-Hans">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>订单管理-鹿程智慧油站商户平台</title>
    <meta name="description" content="鹿程科技是提供加油站互联网化零管系统、营销及支付和大数据分析运营服务的行业领先科技公司。鹿程科技充分了解加油站行业的需求和新兴互联网的发展,依靠业内最先进的科技和标准化的运营,持续帮助油站业务发展创造价值。"
    />
    <meta name="keywords" content="智慧油站,鹿程,鹿程智慧油站,鹿程智慧油站微信支付,加油站微信支付,加油站营销管理" />
    <link rel="icon" href="https://static.zhihuiyouzhan.com.cn/static/styles/admin/img/title.ico" type="image/x-icon">
    <link rel="shortcut icon" href="https://static.zhihuiyouzhan.com.cn/static/styles/admin/img/title.ico" type="image/x-icon">
    <!-- <link href="//netdna.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"> -->
    <link rel="stylesheet" href="../layui/css/layui.css" />
    <link rel="stylesheet" href="../css/style.css" />
</head>

<body>
    <article class="ware-contents">
        <!--form-->
        <form class="layui-form layui-form-pane">
            <!--ware-content-input-->
            <section class="ware-c-input ware-shop-input">
                  <!--list -->
                <div class="layui-form-item">
                    <label class="layui-form-label">商品码号</label>
                    <div class="layui-input-block">
                        <input type="text" name="goods_code"  placeholder="请输商品码号"  onkeyup="value=value.replace(/[^\d]/g,'')" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <!--list -->
                <div class="layui-form-item">
                    <label class="layui-form-label">商品名称<i class="must">*</i></label>
                    <div class="layui-input-block">
                        <input type="text" name="goods_name" lay-verify="required" lay-verType="tips" placeholder="请输入商品名称" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <!--list -->
                <div class="layui-form-item">
                    <label class="layui-form-label">商品分类<i class="must">*</i></label>
                    <div class="layui-input-block">
                        <select name="cate_id" lay-filter="ware-cate" id="Select" lay-verify="classify">
                            <option value="">选择商品分类</option>
                            <option value="0">分类1</option>
                            <option value="1">分类1</option>
                            <option value="2">分类3</option>
                        </select>
                    </div>
                </div>
                <!--list -->
                <div class="layui-form-item">
                    <label class="layui-form-label">商品描述</label>
                    <div class="layui-input-block">
                        <input type="text" name="describe" placeholder="请输入商品描述信息" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <!--list -->
                <div class="layui-form-item">
                    <label class="layui-form-label">市场售价<i class="must">*</i></label>
                    <div class="layui-input-block">
                        <input type="text" name="dprice" lay-verify="num|required" placeholder="请输入产品市场零售价格" lay-verType="tips" autocomplete="off" class="layui-input">
                    </div>
                </div>
                 <!--list -->
                <div class="layui-form-item">
                    <label class="layui-form-label">本店售价<i class="must">*</i></label>
                    <div class="layui-input-block">
                        <input type="text" name="price" lay-verify="num|required" placeholder="请输入产品在本店的零售价格" lay-verType="tips" autocomplete="off"
                            class="layui-input">
                    </div>
                </div>
                 <!--list -->
                <div class="layui-form-item">
                    <label class="layui-form-label">成本价</label>
                    <div class="layui-input-block">
                        <input type="text" name="dprice" lay-verify="num|required" placeholder="请输入产品成本价格" lay-verType="tips" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <!--list -->
                <div class="layui-form-item">
                    <label class="layui-form-label">库存</label>
                    <div class="layui-input-block">
                        <input type="text" name="stock" lay-verify="num|required" placeholder="请输入库存信息" lay-verType="tips" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <!--list -->
                <div class="layui-form-item">
                    <label class="layui-form-label">虚拟销量</label>
                    <div class="layui-input-block">
                        <input type="text" name="sales" lay-verify="num" placeholder="请设置虚拟销量" lay-verType="tips" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <!--list -->
                <div class="layui-form-item">
                    <label class="layui-form-label">商品封面</label>
                    <div class="layui-input-block ">
                        <div class="marke-input-img marke-upload">
                            <input type="text" class="layui-input layui-disabled marke-img" disabled>
                            <span id="pay" class="deer-btn"><i class="layui-icon layui-icon-upload">&#xe67c</i>上传</span>
                            <span class="imgdel deer-btns"> <i class="layui-icon layui-icon-delete"></i>删除</span>
                            <code>建议上传尺寸200*200</code>
                            <dl>
                                <img src="">
                            </dl>
                        </div>
                    </div>

                </div>
            </section>
            <!--/ware-content-input-->
            <!--ware-c-text-->
            <div class="ware-c-text">
                <h4>商品内容</h4>
                <div class="ware-c-txt">
                    <textarea id="ware-text" name="ware-area"></textarea>
                </div>
            </div>
            <!--/ware-c-text-->
            <!--ware-state-->
            <div class="ware-state">
                <input type="radio" name="state" value="上架" title="上架" checked>
                <input type="radio" name="state" value="下架" title="下架">
            </div>
            <!--/ware-state-->
            <!--submit-->
            <div class="ware-submit">
                <button class="submit" lay-submit lay-filter="Submit" lay-verify="editcontent">提交</button>
            </div>

            <!--/submit-->
        </form>
        <!--/form-->
    </article>
    <!--js-->
    <aside>
        <script type="text/javascript" src="../layui/layui.js"></script>
        <script type="text/javascript">
            layui.use(['form', 'jquery', 'upload', 'layedit'], function () {
                var form = layui.form;
                var $ = layui.jquery;
                var upload = layui.upload;
                var layedit = layui.layedit;

                //富文本编辑器
                var index = layedit.build('ware-text', {
                    height: 200,
                    tool: [
                        'strong' //加粗
                        , 'italic' //斜体
                        , 'underline' //下划线
                        , 'del' //删除线
                        , '|' //分割线
                        , 'left' //左对齐
                        , 'center' //居中对齐
                        , 'right' //右对齐
                        , 'link' //超链接
                        , 'unlink' //清除链接
                    ]
                })


                //表单验证
                form.verify({
                    num: [                 //判断是否为数字
                        /^[0-9]*$/
                        , '请输入一个正确的数字'
                    ]
                    , classify: function () {   //判断是否选择分类
                        var val = $('#Select').val()
                        if (val == "") {
                            return '您尚未选则产品分类，暂时还不能提交'
                        } else {
                            return false
                        }
                    }
                    , editcontent: function () {
                        layedit.sync(index); //同步编辑内容到textarea #10line
                    }
                })
                //表单提交
                form.on('submit(Submit)', function (data) {
                    console.log(data.field) //当前容器的全部表单字段，名值对形式：{name: value}
                    $.ajax({
                        url: '/',
                        data: data.field,
                        type: 'post',
                        datatype: 'json',
                        success: function (res) {
                            if (res.code == 1) {
                                layer.msg(res.msg);
                                return;
                            }
                        }
                    });

                    return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
                });

                //图片上传
                upload.render({
                    elem: '#pay' //绑定元素
                    , url: 'https://api-develop.zhihuiyouzhan.com.cn/index.php/system/upload/upload?path=merchant.goods&token={:get_api_token()}' //上传接口
                    , done: function (res) {
                        //上传完毕回调
                        if (res.code == 0) {
                            $('.marke-img').eq(0).val(res.data.domain + res.data.list[0])
                        } else {
                            layer.msg(res.msg, { icon: 2 })
                        }

                    }
                    , error: function () {
                        //请求异常回调
                        layer.msg('数据请求异常', { icon: 2 })
                    }
                });






            })


        </script>
    </aside>
    <!--/js-->








</body>
